package com.lsw.jgyf.httpapi;

import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import com.lsw.jgyf.model.BankCardModel;
import com.lsw.jgyf.model.BannerModel;
import com.lsw.jgyf.model.BaseModel;
import com.lsw.jgyf.model.ContractPhoneModel;
import com.lsw.jgyf.model.CreateOrderModel;
import com.lsw.jgyf.model.FenqichanpingModel;
import com.lsw.jgyf.model.FenqigongsiModel;
import com.lsw.jgyf.model.FrontCardModel;
import com.lsw.jgyf.model.FujiaxianModel;
import com.lsw.jgyf.model.HeadModel;
import com.lsw.jgyf.model.HomeFragment1Model;
import com.lsw.jgyf.model.JsonBean;
import com.lsw.jgyf.model.LoginModel;
import com.lsw.jgyf.model.MoreOptionsModel;
import com.lsw.jgyf.model.OrderAuditModel;
import com.lsw.jgyf.model.OrderDetailsModel;
import com.lsw.jgyf.model.OrderModel;
import com.lsw.jgyf.model.PhoneDetailsModel;
import com.lsw.jgyf.model.PhoneModel;
import com.lsw.jgyf.model.ScreenModel;
import com.lsw.jgyf.model.ShopModel;
import com.lsw.jgyf.model.StagingCompanyDetailsModel;
import com.lsw.jgyf.model.StagingCompanyModel;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

/**
 * Created by Administrator on 2018/7/13 0013.
 */

public interface HttpService {

    @FormUrlEncoded
    @POST("v1/account/p_login")
    Observable<BaseModel<LoginModel>> login(@Field("mobile") String phone,
                                            @Field("password") String password);

    @FormUrlEncoded
    @POST("v1/account/code_login")
    Observable<BaseModel<LoginModel>> loginphone(@Field("mobile") String phone,
                                                 @Field("code") String code);

    @FormUrlEncoded
    @POST("v1/account/clerk_register")
    Observable<BaseModel<LoginModel>> registerDianyuan(@Field("store_id") String store_id,
                                                       @Field("username") String username,
                                                       @Field("code") String code,
                                                       @Field("password") String password,
                                                       @Field("password_confirmation") String password_confirmation,
                                                       @Field("mobile") String mobile
    );

    @FormUrlEncoded
    @POST("v1/account/store_register")
    Observable<BaseModel<LoginModel>> registerDianzhang(@Field("store_num") String store_num,
                                                        @Field("name") String name,
                                                        @Field("store_phone") String store_phone,
                                                        @Field("province_id") String province_id,
                                                        @Field("city_id") String city_id,
                                                        @Field("area_id") String area_id,
                                                        @Field("address") String address,
                                                        @Field("control_username") String control_username,
                                                        @Field("control_mobile") String control_mobile,
                                                        @Field("clerk_username") String clerk_username,
                                                        @Field("clerk_mobile") String clerk_mobile,
                                                        @Field("code") String code,
                                                        @Field("password") String password,
                                                        @Field("password_confirmation") String password_confirmation
    );

    @POST("v1/area/list")
    Observable<BaseModel<List<JsonBean>>> getAddress();

    @POST("v1/store/list")
    Observable<BaseModel<List<ShopModel>>> getShop();

    @FormUrlEncoded
    @POST("v1/account/change_pwd")
    Observable<BaseModel<LoginModel>> ChangePassWord(@Field("old_password") String old_password,
                                                     @Field("password") String password,
                                                     @Field("password_confirmation") String password_confirmation);

    @FormUrlEncoded
    @POST("v1/company/list")
    Observable<BaseModel<List<StagingCompanyModel>>> StagingCompany(@Field("page") String page,
                                                                    @Field("name") String name);

    @FormUrlEncoded
    @POST("v1/company/show")
    Observable<BaseModel<StagingCompanyDetailsModel>> StagingCompanyDetails(@Field("id") String id);

    @FormUrlEncoded
    @POST("v1/phone/list")
    Observable<BaseModel<PhoneModel>> PhoneList(@Field("page") String page,
                                                @Field("name") String name,
                                                @Field("brand_id") String brand_id,
                                                @Field("min_price") String min_price,
                                                @Field("max_price") String max_price,
                                                @Field("order_by") String order_by,
                                                @Field("is_contract") String is_contract);

    @POST("v1/banner")
    Observable<BaseModel<BannerModel>> getBanner();

    @POST("v1/phone/select")
    Observable<BaseModel<ScreenModel>> getScreen();

    @FormUrlEncoded
    @POST("v1/phone/show")
    Observable<BaseModel<PhoneDetailsModel>> getPhoneDetails(@Field("id") String id);

    @FormUrlEncoded
    @POST("v1/sms")
    Observable<BaseModel<List<Object>>> SendCode(@Field("mobile") String mobile, @Field("type") String type);

    @Multipart
    @POST("v1/user/bank_card_confirm")
    Observable<BaseModel<BankCardModel>> UpBankcard(@Part MultipartBody.Part part);

    @Multipart
    @POST("v1/user/id_back_confirm")
    Observable<BaseModel<FrontCardModel>> upBackcardImage(@Part List<MultipartBody.Part> part);

    @Multipart
    @POST("v1/user/id_front_confirm")
    Observable<BaseModel<FrontCardModel>> upFrontcardImage(@Part MultipartBody.Part part);

    @FormUrlEncoded
    @POST("v1/order/select_company")
    Observable<BaseModel<List<FenqigongsiModel>>> selectcompany(@Field("periods") String periods, @Field("insurance_id") String insurance_id);

    @FormUrlEncoded
    @POST("v1/package/list")
    Observable<BaseModel<List<ContractPhoneModel>>> selecttaocan(@Field("operator_id") String operator_id);

    @FormUrlEncoded
    @POST("v1/order/select_product")
    Observable<BaseModel<List<FenqichanpingModel>>> selectproduct(@Field("periods") String periods, @Field("insurance_id") String insurance_id, @Field("company_id") String company_id);

    @FormUrlEncoded
    @POST("v1/order/more_case")
    Observable<BaseModel<List<MoreOptionsModel>>> more_case(@Field("price") String price, @Field("insurance_id") String insurance_id, @Field("first_money") String first_money, @Field("num") String num, @Field("periods") String periods);

    @FormUrlEncoded
    @POST("v1/order/select_insurance")
    Observable<BaseModel<List<FujiaxianModel>>> Fujiaxian(@Field("periods") String periods);

    @FormUrlEncoded
    @POST("v1/order/create")
    Observable<BaseModel<CreateOrderModel>> CreateOrder(@Field("phone_id") String phone_id,
                                                        @Field("memory") String memory,
                                                        @Field("color") String color,
                                                        @Field("num") String num,
                                                        @Field("is_new") String is_new,
                                                        @Field("mobile") String mobile,
                                                        @Field("package_id") String packageX,
                                                        @Field("price") String price,
                                                        @Field("periods") String periods,
                                                        @Field("insurance_id") String insurance_id,
                                                        @Field("company_id") String company_id,
                                                        @Field("company_product_id") String company_product_id,
                                                        @Field("first_money") String first_money,
                                                        @Field("name") String name,
                                                        @Field("sex") String sex,
                                                        @Field("id_number") String id_number,
                                                        @Field("address") String address,
                                                        @Field("issue_time") String issue_time,
                                                        @Field("end_time") String end_time,
                                                        @Field("issue") String issue,
                                                        @Field("bank_name") String bank_name,
                                                        @Field("bank_card_number") String bank_card_number,
                                                        @Field("buy_type") String buy_type,
                                                        @Field("discount_price") String discount_price,
                                                        @Field("package_expenses") String package_expenses);

    @FormUrlEncoded
    @POST("v1/order/list")
    Observable<BaseModel<OrderModel>> getOrder(@Field("search") String search, @Field("status") String status, @Field("page") String page);

    @FormUrlEncoded
    @POST("v1/order/show")
    Observable<BaseModel<OrderDetailsModel>> getOrderDetails(@Field("id") String id);

    @FormUrlEncoded
    @POST("v1/account/forget_pwd")
    Observable<BaseModel<LoginModel>> ForgetPassWord(@Field("mobile") String mobile, @Field("code") String code, @Field("password") String password, @Field("password_confirmation") String password_confirmation);

    @FormUrlEncoded
    @POST("v1/index")
    Observable<BaseModel<HomeFragment1Model>> getindex(@Field("name") String name, @Field("page") String page);

    @FormUrlEncoded
    @POST("v1/order/deny")
    Observable<BaseModel<OrderAuditModel>> AuditFailure(@Field("id") String id, @Field("deny_type") String deny_reason);

    @FormUrlEncoded
    @POST("v1/order/pass")
    Observable<BaseModel<OrderAuditModel>> AuditSuccess(@Field("id") String id);

    @Multipart
    @POST("v1/clerk/set_head")
    Observable<BaseModel<HeadModel>> uphead(@Part MultipartBody.Part part);

}
